aside#left-menu.full-size(
	ng-class="{ 'shown': ui.leftMenuShown }"
	ng-cloak
)
	h4 #{translate("download")}

	ul.list-unstyled.nav.nav-downloads.text-center
		li
			a(
				ng-href="/project/{{project_id}}/download/zip"
				target="_blank"
			)
				i.fa.fa-file-archive-o.fa-2x
				br
				| #{translate("source")}
		li
			a(
				ng-href="{{pdf.downloadUrl || pdf.url}}"
				target="_blank"
				ng-if="pdf.url"
			)
				i.fa.fa-file-pdf-o.fa-2x
				br
				| PDF
			div.link-disabled(
				ng-if="!pdf.url"
				tooltip=translate('please_compile_pdf_before_download')
				tooltip-placement="bottom"
			)
				i.fa.fa-file-pdf-o.fa-2x
				br
				| PDF
				
	span(ng-show="!anonymous")
		h4 #{translate("actions")}
		ul.list-unstyled.nav
			li(ng-controller="CloneProjectController")
				a(
					href,
					ng-click="openCloneProjectModal()"
				)
					i.fa.fa-fw.fa-copy
					| &nbsp;&nbsp; #{translate("copy_project")}

			!= moduleIncludes("editorLeftMenu:actions", locals)
			li(ng-controller="WordCountController")
				a(href, ng-if="pdf.url" ,ng-click="openWordCountModal()")
					i.fa.fa-fw.fa-eye
					span &nbsp;&nbsp; #{translate("word_count")}
				a.link-disabled(href, ng-if="!pdf.url" , tooltip=translate('please_compile_pdf_before_word_count'))
					i.fa.fa-fw.fa-eye
					span.link-disabled &nbsp;&nbsp; #{translate("word_count")}	

	if (moduleIncludesAvailable("editorLeftMenu:sync"))
		div(ng-show="!anonymous")
			h4() #{translate("sync")}
			!= moduleIncludes("editorLeftMenu:sync", locals)
	
	if (moduleIncludesAvailable("editorLeftMenu:editing_services"))
		span(ng-show="!anonymous")
			h4 #{translate("services")}
			!= moduleIncludes("editorLeftMenu:editing_services", locals)


	if showTestControls
		h4 Test Controls
		ul.list-unstyled.nav(ng-controller="TestControlsController")
			li
				a(href="#" ng-click="richText()")
					i.fa.fa-exclamation.fa-fw
					| Rich Text


	h4(ng-show="!anonymous") #{translate("settings")}
	form.settings(ng-controller="SettingsController", ng-show="!anonymous")
		.containter-fluid
			.form-controls(ng-show="permissions.write")
				label(for="compiler") #{translate("compiler")}
				select(
					name="compiler"
					ng-model="project.compiler"
				)
					option(value='pdflatex') pdfLaTeX
					option(value='latex') LaTeX
					option(value='xelatex') XeLaTeX
					option(value='lualatex') LuaLaTeX
					
			.form-controls(ng-show="permissions.write")
				label(for="rootDoc_id") #{translate("main_document")}
				select(
					name="rootDoc_id",
					ng-model="project.rootDoc_id",
					ng-options="doc.doc.id as doc.path for doc in getValidMainDocs()"
				)

			.form-controls
				label(for="spellCheckLanguage") #{translate("spell_check")}
				select(
					name="spellCheckLanguage"
					ng-model="project.spellCheckLanguage"
				)
					option(value="") #{translate("off")}
					optgroup(label="Language")
						for language in languages
							option(
								value=language.code
							)= language.name

			.form-controls
				label(for="autoComplete") #{translate("auto_complete")}
				select(
					name="autoComplete"
					ng-model="settings.autoComplete"
					ng-options="o.v as o.n for o in [{ n: 'On', v: true }, { n: 'Off', v: false }]"
				)

			.form-controls
				label(for="autoPairDelimiters") #{translate("auto_close_brackets")}
				select(
					name="autoPairDelimiters"
					ng-model="settings.autoPairDelimiters"
					ng-options="o.v as o.n for o in [{ n: 'On', v: true }, { n: 'Off', v: false }]"
				)

			.form-controls.code-check-setting
				label(for="syntaxValidation") #{translate("syntax_validation")}
				select(
					name="syntaxValidation"
					ng-model="settings.syntaxValidation"
					ng-options="o.v as o.n for o in [{ n: 'On', v: true }, { n: 'Off', v: false }]"
				)

			.form-controls
				label(for="editorTheme") #{translate("editor_theme")}
				select(
					name="editorTheme"
					ng-model="settings.editorTheme"
				)
					each editorTheme in editorThemes
						option(value=editorTheme) #{editorTheme.replace(/_/g, ' ')}

			- if (settings.overleaf != null && !isIEEE(brandVariation))
				.form-controls
					label(for="overallTheme") #{translate("overall_theme")}
					select(
						name="overallTheme"
						ng-if="!ui.loadingStyleSheet"
						ng-model="settings.overallTheme"
						ng-options="overallTheme.val as overallTheme.name for overallTheme in overallThemesList"
					)
					p.loading.pull-right(
						ng-if="ui.loadingStyleSheet"
					)
						i.fa.fa-fw.fa-spin.fa-refresh

			.form-controls(ng-show="!anonymous")
				label(for="mode") #{translate("keybindings")}
				select(
					name="mode"
					ng-model="settings.mode"
				)
					option(value='default') None
					option(value='vim') Vim
					option(value='emacs') Emacs

			.form-controls
				label(for="fontSize") #{translate("font_size")}
				select(
					name="fontSize"
					ng-model="fontSizeAsStr"
					ng-model-options="{ getterSetter: true }"
				)
					each size in ['10','11','12','13','14','16','18','20','22','24']
						option(value=size) #{size}px

			.form-controls
				label(for="fontFamily") #{translate("font_family")}
				select(
					name="fontFamily"
					ng-model="settings.fontFamily"
				)
					option(value="", disabled) #{translate("default")}
					each fontFamily in ['monaco', 'lucida']
						option(value=fontFamily) #{capitalize(fontFamily)}

			.form-controls
				label(for="lineHeight") #{translate("line_height")}
				select(
					name="lineHeight"
					ng-model="settings.lineHeight"
				)
					option(value="", disabled) #{translate("default")}
					each lineHeight in ['compact', 'normal', 'wide']
						option(value=lineHeight) #{translate(lineHeight)}

			.form-controls
				label(for="pdfViewer") #{translate("pdf_viewer")}
				select(
					name="pdfViewer"
					ng-model="settings.pdfViewer"
				)
					option(value="pdfjs") #{translate("built_in")}
					option(value="native") #{translate("native")}

			if (getSessionUser() && getSessionUser().isAdmin && typeof(allowedImageNames) !== 'undefined' && allowedImageNames.length > 0)
				.form-controls(ng-show="permissions.write")
					label(for="imageName") #{translate("TeXLive")}
					select(
						name="imageName"
						ng-model="project.imageName"
					)
						each image in allowedImageNames
							option(value=image.imageName) #{image.imageDesc}

	h4 #{translate("hotkeys")}
	ul.list-unstyled.nav
		li(ng-controller="HotkeysController")
			a(ng-click="openHotkeysModal()")
				i.fa.fa-keyboard-o.fa-fw
				| &nbsp;&nbsp; #{translate("show_hotkeys")}

#left-menu-mask(
	ng-show="ui.leftMenuShown",
	ng-click="ui.leftMenuShown = false"
	ng-cloak
)

script(type='text/ng-template', id='cloneProjectModalTemplate')
	.modal-header
		h3 #{translate("copy_project")}
	.modal-body
		.alert.alert-danger(ng-show="state.error.message") {{ state.error.message}} 
		.alert.alert-danger(ng-show="state.error && !state.error.message") #{translate("generic_something_went_wrong")}
		form(name="cloneProjectForm", novalidate)
			.form-group
				label #{translate("new_name")}
				input.form-control(
					type="text",
					placeholder="New Project Name",
					required,
					ng-model="inputs.projectName",
					on-enter="clone()",
					focus-on="open"
				)
	.modal-footer
		button.btn.btn-default(
			ng-disabled="state.inflight"
			ng-click="cancel()"
		) #{translate("cancel")}
		button.btn.btn-primary(
			ng-disabled="cloneProjectForm.$invalid || state.inflight"
			ng-click="clone()"
		)
			span(ng-hide="state.inflight") #{translate("copy")}
			span(ng-show="state.inflight") #{translate("copying")}...

script(type='text/ng-template', id='wordCountModalTemplate')
	.modal-header
		h3 #{translate("word_count")}
	.modal-body
		div(ng-if="status.loading")
			.loading(ng-show="!status.error && status.loading")
				i.fa.fa-refresh.fa-spin.fa-fw 
				span &nbsp; #{translate("loading")}...  
			div.pdf-disabled(
				ng-if="!pdf.url"
				tooltip=translate('please_compile_pdf_before_word_count')
				tooltip-placement="bottom"
			)
		div(ng-if="!status.loading")
			.container-fluid
				.row(ng-show='data.messages.length > 0')
					.col-xs-12
						.alert.alert-danger
							p(style="white-space: pre-wrap") {{data.messages}}
				.row
					.col-xs-4
						.pull-right #{translate("total_words")} :
					.col-xs-6 {{data.textWords}}
				.row 
					.col-xs-4
						.pull-right #{translate("headers")} :
					.col-xs-6 {{data.headers}}
				.row 
					.col-xs-4 
						.pull-right #{translate("math_inline")} :
					.col-xs-6 {{data.mathInline}}
				.row 
					.col-xs-4 
						.pull-right #{translate("math_display")} :
					.col-xs-6 {{data.mathDisplay}}
	.modal-footer
		button.btn.btn-default(
			ng-disabled="state.inflight"
			ng-click="cancel()"
		) #{translate("done")}

